import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
      theme: ThemeData(
          primaryColor: Colors.amber,
          primarySwatch: Colors.pink,
          iconTheme: IconThemeData(color: Colors.purple),
          platform: TargetPlatform.fuchsia,
          cursorColor: Colors.blue,
          dividerColor: Colors.cyan),
      home: Scaffold(
        appBar: AppBar(
          title: Text("ThemeData配置"),
        ),
        body: ThemeDataWidget(),
        floatingActionButton: FloatingActionButton(
          onPressed: () {},
          child: Icon(Icons.add),
        ),
      ),
    ));

class ThemeDataWidget extends StatefulWidget {
  @override
  _ThemeDataWidgetState createState() => _ThemeDataWidgetState();
}

class _ThemeDataWidgetState extends State<ThemeDataWidget> {
  @override
  Widget build(BuildContext context) {
    ThemeData themeData = Theme.of(context);
    return Theme(
      data: ThemeData(
          primaryColor: Colors.green,
          primarySwatch: Colors.deepOrange,
          iconTheme: IconThemeData(color: Colors.red)),
      child: Container(
        child: Center(child: Icon(Icons.ac_unit)),
      ),
    );
  }
}
